﻿<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <title>Tables</title>

    <!-- Bootstrap -->
    <link href="<%=basePath %>bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
    <link href="<%=basePath %>bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" media="screen">
    <link href="<%=basePath %>assets/styles.css" rel="stylesheet" media="screen">
    <link href="<%=basePath %>assets/DT_bootstrap.css" rel="stylesheet" media="screen">
    <!--[if lte IE 8]><script language="javascript" type="text/javascript" src="vendors/flot/excanvas.min.js"></script><![endif]-->
    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <script src="<%=basePath %>vendors/modernizr-2.6.2-respond-1.1.0.min.js"></script>
    <script src="<%=basePath %>js/jquery.min.js"></script>
    <script src="<%=basePath %>js/mobiscroll_002.js" type="text/javascript"></script>
    <script src="<%=basePath %>js/mobiscroll_004.js" type="text/javascript"></script>
    <link href="<%=basePath %>js/mobiscroll_002.css" rel="stylesheet" type="text/css">
    <link href="<%=basePath %>js/mobiscroll.css" rel="stylesheet" type="text/css">
    <script src="<%=basePath %>js/mobiscroll.js" type="text/javascript"></script>
    <script src="<%=basePath %>js/mobiscroll_003.js" type="text/javascript"></script>
    <script src="<%=basePath %>js/mobiscroll_005.js" type="text/javascript"></script>
    <link href="<%=basePath %>js/mobiscroll_003.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="<%=basePath %>js/jquery-1.7.2.js"></script>
    <script type="text/javascript" src="<%=basePath %>js/jquery.jedate.js"></script>
    <link type="text/css" rel="stylesheet" href="<%=basePath %>assets/jedate.css">
 <style>
        #contentjun{
            margin-left: 25%;
        }

        .block1{
            position: relative;
        }
        .block1 .btn-toolbar{
            position: absolute;
            top: -4px;
            right: -5%;
            width: 200px;
        }
        .block{
            position: relative;
        }
        .block .btn-toolbar{
            position: absolute;
            top: -4px;
            right: -5%;
            width: 200px;
        }
        .ss{
            width: 280px;
            position: relative;
            top: 37px;
            left: 63%;
        }

        #example_filter label{
            display: none;
        }
    </style>
</head>

<body>
<%
    if(request.getSession().getAttribute("acc") == null) {
        response.sendRedirect("../emp/adminLogin");
    }
%>
<div class="navbar navbar-fixed-top">
    <div class="navbar-inner">
        <div class="container-fluid">
            <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </a>
          <a class="brand">麦包郎后台管理系统</a>

            <!--/.nav-collapse -->
        </div>
    </div>
</div>
<div class="container-fluid">
    <div class="row-fluid">
        <div class="span3" id="sidebar">
            <ul class="nav nav-list bs-docs-sidenav nav-collapse collapse">
                <li>
					<a href="<%=basePath%>emp/getAll"><i class="icon-chevron-right"></i> 店铺管理</a>
				</li>
					
				<li>
					<a href="<%=basePath%>shop/today"><i class="icon-chevron-right"></i>今日订单 </a>
				</li>

				<li class="active">
					<a href="<%=basePath%>ord/selectli"><i class="icon-chevron-right"></i> 历史订单</a>
				</li>

						
				<li>
					<a href="<%=basePath%>commodity/tong"><i class="icon-chevron-right"></i>食材管理</a>
				</li>
				<li>
					<a href="<%=basePath%>ord/caiwu"><i class="icon-chevron-right"></i>财务管理</a>
				</li>

            </ul>
        </div>
        <!--/span-->
        <div class="span9" id="content">





            <div class="row-fluid">
                <!-- block -->
                <div class="block">
                    <div class="navbar navbar-inner block-header">

                        <div class="muted pull-left">历史订单</div>

                   &nbsp;  &nbsp;  &nbsp;  &nbsp;
                       <input style="margin-top: 5px;" class="xiugai1"  id="date03" type="button" placeholder="YYYY-MM-DD" value="${time}" >
                        <div style="height:15px; margin-left: 10px;"  class="xiugai">
                            <p style="position: relative;top: -5px;">今日累计金额：<span><fmt:formatNumber type="number" value="${total}" maxFractionDigits="1"/>元</span></p>
                            <input style="position:relative;top: -45px;left: 110px;"  value="查询 " class="btn btn-info"  type="button" onclick="cha()" />
                        </div>
                        <div id="datePlugin"></div>

                    </div>
                    <div class="block-content collapse in">
                        <div class="span12">

                            <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="example">
                                     <div class="ss">
                                   <input type="text" id="sou1">
                                   <input style="margin-top: -10px"  class="btn btn-info" onclick="sousuo()"  type="button" value="搜索">

                               </div>
                                <thead>
                                <tr>
                                    <th>店铺编号</th>
                                    <th>店铺名称</th>
                                    <th>用户名</th>
                                    <th>收货人</th>
                                    <th>详情</th>
                                </tr>
                                </thead>
                                <tbody>
                                <c:forEach items="${list}" var="li">
                                <tr class="odd gradeX">
                                    <td>${li.id}</td>
                                    <td>${li.name}</td>
                                    <td>${li.account}</td>
                                    <td class="center">${li.aname}</td>
                                    <td class="center"> 	
                                    <c:if test="${li.ce>0}">
                                    <button class="btn btn-danger" style="background-color:red;" onclick="xiang(${li.id})">详情</button>
                                    </c:if>
                                    
                                     <c:if test="${li.ce<=0}">
                                    <button class="btn btn-info" onclick="xiang(${li.id})">详情</button>
                                    </c:if>
                                    </td>
                                </tr>
                                </c:forEach>
                             
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <!-- /block -->
            </div>


        </div>
    </div>
    <hr>

</div>





<!--/.fluid-container-->
<div class="span9" id="contentjun">


    <div class="row-fluid">
        <!-- block -->
        <div class="block">
            <div id="junjun2" class="navbar navbar-inner block-header">
                <div class="muted pull-left">清单统计</div>
<div style="height:15px; margin-left: 10px;"  class="btn btn-info">
                           <p style="position: relative;top: -5px;">价钱总计：<span><fmt:formatNumber type="number" value="${total}" maxFractionDigits="1"/>元</span></p>
                       </div>

            </div>
            <div class="block-content collapse in">
                <div class="span12">
                    <div class="table-toolbar">


                    </div>
                    <!--startprint-->
                    <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="example2">
                       
                        <thead>
                         <tr>
                            <th>商品名称</th>
                            <th>数量</th>
                        </tr>
                        
                        
                        </thead>
                        <tbody>
                        <c:forEach items="${comList}" var="com">
                        	<tr class="odd gradeX">
                            <c:if test="${com.num!=0}">
                            <td>${com.name}</td>
                            <td>${com.num}</td>
                  </c:if>
                            
                        </tr>
                        </c:forEach>


                        </tbody>
                    </table><!--endprint-->
                </div>
            </div>
        </div>
        <!-- /block -->
    </div>
</div>
<!--/.fluid-container-->

<!--<script src="vendors/jquery-1.9.1.js"></script>-->
<script src="<%=basePath %>bootstrap/js/bootstrap.min.js"></script>
<script src="<%=basePath %>vendors/datatables/js/jquery.dataTables.min.js"></script>


<script src="<%=basePath %>assets/scripts.js"></script>
<script src="<%=basePath %>assets/DT_bootstrap.js"></script>

</body>

<script>window.jQuery || document.write('<script src="js/jquery-1.11.0.min.js"><\/script>')</script>
<script src="<%=basePath%>js/blob.js"></script>
<script src="<%=basePath%>js/xlsx.core.min.js"></script>
<script src="<%=basePath%>js/FileSaver.min.js"></script>
<script src="<%=basePath%>js/tableexport.js"></script>

<script type="text/javascript">
    $(function(){
        $(".block").tableExport({formats:["xlsx"]});
        $(".block1").tableExport({formats:["xlsx"]});
    })
</script>
<script type="text/javascript">
    $(function () {
        var currYear = (new Date()).getFullYear();
        var opt={};
        opt.date = {preset : 'date'};
        opt.datetime = {preset : 'datetime'};
        opt.time = {preset : 'time'};
        opt.default = {
            theme: 'android-ics light', //皮肤样式
            display: 'modal', //显示方式
            mode: 'scroller', //日期选择模式
            dateFormat: 'yyyy-mm-dd',
            lang: 'zh',
            showNow: true,
            nowText: "今天",
            startYear: currYear - 10, //开始年份
            endYear: currYear + 10 //结束年份
        };

        $("#appDate").mobiscroll($.extend(opt['date'], opt['default']));
        var optDateTime = $.extend(opt['datetime'], opt['default']);
        var optTime = $.extend(opt['time'], opt['default']);
        $("#appDateTime").mobiscroll(optDateTime).datetime(optDateTime);
        $("#appTime").mobiscroll(optTime).time(optTime);
    });
    /* var btn = document.getElementsByClassName("btn");
    for(var i =0;i<btn.length;i++){
        btn[i].onclick = function () {
            window.location.href="lsxq.jsp";
        }
    } */
    
    //实现日期选择联动
    var start = {
        format: 'YYYY-MM-DD',
        minDate: '2014-06-16 23:59:59', //设定最小日期为当前日期
        //festival:true,
        maxDate: $.nowDate({DD:0}), //最大日期
        choosefun: function(elem,datas){
            end.minDate = datas; //开始日选好后，重置结束日的最小日期
            endDates();
        },
        okfun:function (elem,datas) {
            alert(datas)
        }
    };


    $("#date03").jeDate({
        isinitVal:true,
        //festival:true,
        ishmsVal:false,
        minDate: '2016-06-16',
        maxDate: $.nowDate({DD:0}),
        format:"YYYY-MM-DD",
        zIndex:3000,
    });
    
    function cha(){
    	var time=$("#date03").val();
    	window.location.href="seleteByTime?time="+time;
    }
    
    function xiang(id){
    	var time=$("#date03").val();
    	window.location.href="seleteByTimeAndId?time="+time+"&id="+id;
    }
    
    function sousuo(){
    	var word="word="+$("#sou1").val()+"&time="+$("#date03").val();
    	word=encodeURI(encodeURI(word));
    	window.location.href="selectLiComByWord?"+word;
    }
</script>

</html>